home *** CD-ROM | disk | FTP | other *** search
/ PCGUIA 127 / PC Guia 127.iso / Software / Produtividade / OpenOffice.org 2.0.1 / openofficeorg4.cab / test_eof.py < prev    next >
Text File  |  2005-11-19  |  869b  |  33 lines

  1. #! /usr/bin/env python
  2. """test script for a few new invalid token catches"""
  3.  
  4. import os
  5. import unittest
  6. from test import test_support
  7.  
  8. class EOFTestCase(unittest.TestCase):
  9.     def test_EOFC(self):
  10.         try:
  11.             eval("""'this is a test\
  12.             """)
  13.         except SyntaxError, msg:
  14.             self.assertEqual(str(msg),
  15.                              "EOL while scanning single-quoted string (line 1)")
  16.         else:
  17.             raise test_support.TestFailed
  18.  
  19.     def test_EOFS(self):
  20.         try:
  21.             eval("""'''this is a test""")
  22.         except SyntaxError, msg:
  23.             self.assertEqual(str(msg),
  24.                              "EOF while scanning triple-quoted string (line 1)")
  25.         else:
  26.             raise test_support.TestFailed
  27.  
  28. def test_main():
  29.     test_support.run_unittest(EOFTestCase)
  30.  
  31. if __name__ == "__main__":
  32.     test_main()
  33.